package com.rent.business.interceptor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author zhang
 * @create 2021/7/2 17:00
 */
@Slf4j
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor serverConfig;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        log.info("添加自定义拦截");
        registry.addInterceptor(serverConfig).addPathPatterns("/**");
    }
}
